
// 封装的全局常用的js 方法。
import { Notification,Loading,Message } from 'element-ui'

export  default {
    AlertErrorMsg:function (msg) {
      Notification({
        title: '系统提示:',
        message: '<p style="color: red">'+msg+'</p>',
        position: 'top-left',
        showClose:'true',
        duration:'3000',
        type:'error',
        dangerouslyUseHTMLString:'true',
      });

    },

  AlertSuccessMsg:function (msg) {
    Notification({
      title: '系统提示:',
      message: '<p style="color: greenyellow">'+msg+'</p>',
      position: 'top-left',
      showClose:'true',
      duration:'3000',
      type:'success',
      dangerouslyUseHTMLString:'true',
    });

  },

//   加载loading....
   AlertLoading:function (msg,icon) {
     var text = 'loading..'
     var spinner = 'el-icon-loading'
     if (msg) {
       text = msg
     }
     if (icon) {
       spinner = icon
     }
      var options ={
          text,
            spinner,
        // lock:true,
        background: 'rgba(0,0,0,0.7)'
      }
    return Loading.service(options);
   },

  // 操作提示
  AlertOperationSuccess(msg,time){
    Message({
      dangerouslyUseHTMLString: true,
      message: '<strong>'+msg+'</strong>',
      customClass: 'operateSuccess',    //自定义的样式
      center: true,
      iconClass: 'iconfont icon-emotion',
      offset:'100',
      duration:time

    })

  }



}
